<template>
  <div>
    <Chart :cdata="cdata" />
  </div>
</template>

<script>
import Chart from './chart.vue'
export default {
  data () {
    return {
      cdata: {
        category: [
          "2023/4/10",
          "2023/4/11",
          "2023/4/12",
          "2023/4/13",
          "2023/4/14",
          "2023/4/15",
          "2023/4/16",
          "2023/4/17",
          "2023/4/18",
          "2023/4/19",
          "2023/4/20",
          "2023/4/21",
          "2023/4/22",
          "2023/4/23",
          "2023/4/24",
          "2023/4/25",
          "2023/4/26",
          "2023/4/27",
          "2023/4/28",
          "2023/4/29",
          "2023/4/30",
          "2023/5/1",
          "2023/5/2",
          "2023/5/3",
          "2023/5/4",
          "2023/5/5",
          "2023/5/6",
          "2023/5/7",
          "2023/5/8",
          "2023/5/9",
          "2023/5/10",
          "2023/5/11",
          "2023/5/12"
        ],
        lineData: [
          18092,
          20728,
          24045,
          28348,
          32808,
          36097,
          39867,
          44715,
          48444,
          50415,
          56061,
          62677,
          59521,
          67560,
          18092,
          20728,
          24045,
          28348,
          32808,
          36097,
          39867,
          44715,
          48444,
          50415,
          36097,
          39867,
          44715,
          48444,
          50415,
          50061,
          32677,
          49521,
          32808
        ],
        barData: [
          4600,
          5000,
          5500,
          6500,
          7500,
          8500,
          9900,
          12500,
          14000,
          21500,
          23200,
          24450,
          25250,
          33300,
          4600,
          5000,
          5500,
          6500,
          7500,
          8500,
          9900,
          22500,
          14000,
          21500,
          8500,
          9900,
          12500,
          14000,
          21500,
          23200,
          24450,
          25250,
          7500
        ],
        rateData: []
      }
    };
  },
  components: {
    Chart,
  },
  mounted () {
    this.setData();
  },
  methods: {
    // 根据自己的业务情况修改
    setData () {
      for (let i = 0; i < this.cdata.barData.length -1; i++) {
        let rate = this.cdata.barData[i] / this.cdata.lineData[i];
        this.cdata.rateData.push(rate.toFixed(2));
      }
    },
  }
};
</script>

<style lang="scss" scoped>
</style>